package me.ydq.core.sql;

import me.ydq.core.SqlSpec;
import me.ydq.misc.Fn;

import java.util.function.Supplier;

public interface SqlNotEquals<T> {

    SqlSpec<T> ne(Fn<T, ?> fn, Object value);

    SqlSpec<T> ne(String column, Object value);

    default SqlSpec<T> ne(Supplier<Boolean> condition, Fn<T, ?> fn, Supplier<Object> valGet) {
        return ne(Boolean.TRUE.equals(condition.get()), fn, valGet);
    }

    default SqlSpec<T> ne(Supplier<Boolean> condition, Fn<T, ?> fn, Object val) {
        return ne(Boolean.TRUE.equals(condition.get()), fn, val);
    }

    default SqlSpec<T> ne(boolean condition, Fn<T, ?> fn, Supplier<Object> valGet) {
        return condition ? ne(fn, valGet.get()) : (SqlSpec<T>) this;
    }

    default SqlSpec<T> ne(boolean condition, Fn<T, ?> fn, Object val) {
        return condition ? ne(fn, val) : (SqlSpec<T>) this;
    }

    default SqlSpec<T> ne(Fn<T, ?> fn, Supplier<Object> valGet) {
        return ne(fn, valGet.get());
    }

    default SqlSpec<T> ne(Supplier<Boolean> condition, String rawColumn, Supplier<Object> valGet) {
        return ne(Boolean.TRUE.equals(condition.get()), rawColumn, valGet);
    }

    default SqlSpec<T> ne(Supplier<Boolean> condition, String rawColumn, Object val) {
        return ne(Boolean.TRUE.equals(condition.get()), rawColumn, val);
    }

    default SqlSpec<T> ne(boolean condition, String rawColumn, Supplier<Object> valGet) {
        return condition ? ne(rawColumn, valGet.get()) : (SqlSpec<T>) this;
    }

    default SqlSpec<T> ne(boolean condition, String rawColumn, Object val) {
        return condition ? ne(rawColumn, val) : (SqlSpec<T>) this;
    }

    default SqlSpec<T> ne(String rawColumn, Supplier<Object> valGet) {
        return ne(rawColumn, valGet.get());
    }

}
